package com.itboye.mengwu.data.repository;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.gson.reflect.TypeToken;
import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.utils.BaseErrorListener;
import com.itboye.core.utils.BaseSuccessReqListener;
import com.itboye.core.utils.ByJsonRequest.Builder;
import com.itboye.mengwu.data.interfaces.IMePingLunINterfaces;
import com.itboye.mengwu.data.model.MePingLunbean;
import com.itboye.mengwu.data.model.MessgeBean;

public class MePingLunrepository extends BaseNetRepository implements
		IMePingLunINterfaces<MePingLunbean> {

	public static final String MeComment = "BY_BbsUserCenter_queryComment";// 我的评论
	public static final String PingLunMe = "BY_BbsUserCenter_replyPost";// piunglunwode
	public static final String DianzanMe = "BY_BbsUserCenter_likeMe";// 点赞我的
	public static final String MeReply = "BY_BbsUserCenter_queryPost";// 我的回复
	public static final String ReplyMe = "BY_BbsUserCenter_replyThread";// 回复我的
	public MePingLunrepository(ICompleteListener listener) {
		super(listener);
	}

	@Override
	public void add(MePingLunbean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(MePingLunbean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(MePingLunbean model) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<MePingLunbean>() {
		}.getType();
		String apiVer = "100";
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", model.getUid());
		map.put("page_no", model.getPageNo());

		(new Builder<MePingLunbean>())
				.setTypeVerParamsAndReturnClass(ReplyMe, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<MePingLunbean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void getInfo(MePingLunbean model) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<MePingLunbean>() {
		}.getType();
		String apiVer = "100";
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", model.getUid());
		map.put("page_no", model.getPageNo());
		(new Builder<MePingLunbean>())
				.setTypeVerParamsAndReturnClass(MeReply, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<MePingLunbean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public List<MePingLunbean> query(MePingLunbean model) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void dianzanMe(String uid, String pageNo) {
		// TODO Auto-generated method stub

		Type type = new TypeToken<MePingLunbean>() {
		}.getType();
		String apiVer = "100";
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("page_no", pageNo);
		(new Builder<MePingLunbean>())
				.setTypeVerParamsAndReturnClass(DianzanMe, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<MePingLunbean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

}
